<html>
<head>
	<meta charset='utf-8' />
	<title>记事本</title>
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
	<style>
		@media screen and (max-width:450px){
			#content{width:98%;margin:0 auto}
			/*页面宽度900以下时 .abc的宽度为450*/
		}
		@media screen and (min-width:450px){
			#content{width:450px;margin:0 auto}
			/*页面宽度900以下时 .abc的宽度为450*/
		}
	</style>
</head>
<body style='padding:0;margin:0;background:#eee'>
<!-- 1 Content容器 -->
<div id='Content' style='border:0px solid'>

	<div style='display:flex;flex-direction:column;height:100%'>

		<h3 style='text-align:center;height:30px'>新建记事本</h3>

		<div style='margin:10px 0;height:30px'>
			<input type="text" style='width:100%' id='title' placeholder='输入标题' />
		</div>

		<textarea id="info" style='width:100%;height:100%' placeholder='输入内容.......' ></textarea>

		<div style='text-align:center;margin:20px 0;height:30px'>
			<button id='submit'>提交</button>　
			<button onclick='history.go(-1)'>返回</button>
		</div>

	</div>
</div><!-- 1 Content容器结束 -->


</body>
</html>
<script src='public/jquery.js'></script>
<script src='public/fun.js'></script>
<script>


CheckLoginBefore();		//### 检测前台登陆状态和token1

$(function(){
	$('#submit').click(function(){
		var title = $('#title').val().trim();
		var info = $('#info').val().trim();
		if(!title){
			A('缺少信息！');return;
		}

		var data = {
			type:'create_notpad',
			title:title,
			info:info
		}
		AjaxBefore(data,function(res){
			if(!/^{.*}$/.test(res)){
				A('操作异常！');return;
			}
			var tmp = JSON.parse(res);
			sessionStorage.token1 = tmp.token1;
			if(tmp.stat == 'ok'){
				A('操作成功！');
				location.href='index.html';
			}else{
				A('操作异常！');
			}
		});
	});


});

</script>